package ninja9.muzik.dao;

import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 * PlaylistItemId entity. @author MyEclipse Persistence Tools
 */
@Embeddable
public class PlaylistItemId implements java.io.Serializable {

	// Fields

	private Integer playlistId;
	private Integer songId;

	// Constructors

	/** default constructor */
	public PlaylistItemId() {
	}

	/** full constructor */
	public PlaylistItemId(Integer playlistId, Integer songId) {
		this.playlistId = playlistId;
		this.songId = songId;
	}

	// Property accessors

	@Column(name = "playlist_id", nullable = false)
	public Integer getPlaylistId() {
		return this.playlistId;
	}

	public void setPlaylistId(Integer playlistId) {
		this.playlistId = playlistId;
	}

	@Column(name = "song_id", nullable = false)
	public Integer getSongId() {
		return this.songId;
	}

	public void setSongId(Integer songId) {
		this.songId = songId;
	}

	public boolean equals(Object other) {
		if ((this == other))
			return true;
		if ((other == null))
			return false;
		if (!(other instanceof PlaylistItemId))
			return false;
		PlaylistItemId castOther = (PlaylistItemId) other;

		return ((this.getPlaylistId() == castOther.getPlaylistId()) || (this
				.getPlaylistId() != null && castOther.getPlaylistId() != null && this
				.getPlaylistId().equals(castOther.getPlaylistId())))
				&& ((this.getSongId() == castOther.getSongId()) || (this
						.getSongId() != null && castOther.getSongId() != null && this
						.getSongId().equals(castOther.getSongId())));
	}

	public int hashCode() {
		int result = 17;

		result = 37
				* result
				+ (getPlaylistId() == null ? 0 : this.getPlaylistId()
						.hashCode());
		result = 37 * result
				+ (getSongId() == null ? 0 : this.getSongId().hashCode());
		return result;
	}

}